function compose(...funcs) {
    return funcs.reduce((a, b) => (...args) => a(b(...args)))
}
let promise = (next)=>{
    console.log('compose promise');
    return action=>{
        console.log('promise');
        next(action);
    }
}
let thunk = (next)=>{
    console.log('compose thunk');
    return action=>{
        console.log('thunk');
        next(action);
    }
}
let logger = (next)=>{
    console.log('compose logger');
    return action=>{
        console.log('logger');
        next(action);
    };
}
const chain = [promise,thunk,logger];
let composed = compose(...chain);
let store = {
    dispatch(){console.log('原始的store.dispatch')}
}
let finalDispatch = composed(store.dispatch);
finalDispatch({type:'ADD'});

